package com.ms.teapuesto.util;



import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * User: jmacavilca
 * Date: 01/04/11
 */
public class FileName {
    protected String partName;
    protected String partExt;

    public FileName(File originalFile) {
        String name = originalFile.getName();
        int idx = name.lastIndexOf('.');
        partName = idx < 0  ?  name : name.substring(0, idx);
        partExt = idx < 0  ?  null : name.substring(idx+1);
    }

    public FileName(String originalFile) {
        String name = originalFile;
        int idx = name.lastIndexOf('.');
        partName = idx < 0  ?  name : name.substring(0, idx);
        partExt = idx < 0  ?  null : name.substring(idx+1);
    }

    public String getPartName() {
        return partName;
    }

    public String getPartExt() {
        return partExt;
    }

    public void setPartName(String partName) {
        this.partName = partName;
    }




    public static String pathToUnixFormat(File file) {
        if (file != null) {
            String path = file.getPath();
            return path.replace('\\', '/');
        }else{
            return null;
        }
    }

}
